package cn.yuanqiao.archive.appManager.mapper;

import cn.yuanqiao.archive.appManager.domain.TenantApply;
import com.alibaba.fastjson.JSONArray;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author zjj
 * @date 2023/6/16
 */
public interface TenantApplyMapper {

    int insertTenantApply(TenantApply tenantApply);
    /**getfieldlist
     * Ӧ�ö���
     * @param tableName
     * @return
     */
    int createApplyTable(@Param("tableName") String tableName);

    void initApply(@Param("tableName")String tableName, @Param("categoryIds") String categoryIds);

    List<TenantApply> getApplyModel(@Param("categoryId") Long categoryId);


    /**
     * ��ѯapplymodel
     *
     * @param menuId �˵�id
     * @param categoryId ����id
     * @return applymodel
     */
    public TenantApply selectYqdaApplyModelById(Long menuId,Long categoryId,@Param("tableName") String tableName);

    /**
     * ��ѯapplymodel�б�
     *
     * @param yqdaApplyModel applymodel
     * @return applymodel����
     */
    public List<TenantApply> selectYqdaApplyModelList(TenantApply yqdaApplyModel);


    /**
     * �޸�applymodel
     *
     * @param yqdaApplyModel applymodel
     * @return ���
     */
    public int updateYqdaApplyModel(TenantApply yqdaApplyModel);

    /**
     * ����ɾ��applymodel
     *
     * @param categoryId ����id
     * @param menuId �˵�id
     * @return ���
     */
    public int deleteYqdaApplyModel(Long categoryId,Long menuId,@Param("tableName") String tableName);

    /**
     * ɾ��applymodel��Ϣ
     *
     * @param Id applymodel����
     * @return ���
     */
    public int deleteYqdaApplyModelById(@Param("Id")Long Id, @Param("tableName") String tableName);

    int clonefield(@Param("categoryId")Long categoryId, @Param("clonedmenuId") Long clonedmenuId, @Param("clonetomenuIds") List<String> clonetomenuIds, @Param("tableName") String tableName);

    List<Map<String,String>> selectYqdaApplyModelListmenu(@Param("menuName") String menuName,
                                                          @Param("applyTable") String applyTable,
                                                          @Param("tenantCode") String tenantCode,
                                                          @Param("categoryId") Long categoryId);

    List<Map<String,String>> listAllMenu(@Param("tenantCode") String tenantCode, @Param("roleKey") List<String> roleKey,@Param("categoryId")Long categoryId,@Param("tableName")String tableName);

    String getfieldlist(Long menuId, Long categoryId, String field,@Param("tableName") String tableName);


    int updatemenuId(@Param("tableName")String tableName, @Param("tenantCode")String tenantCode);

    List<Map<String, Object>> getstringforchange(@Param("groupId")Long groupId, @Param("realfield")String realfield, @Param("tableName")String tableName, @Param("catetableName")String catetableName);

    int updateYqdaApplyModelbygroupid(@Param("id")Long id, @Param("realfield")String realfield, @Param("value") String value, @Param("tableName") String tableName);
    int deletebycatemenu(@Param("categoryId")Long categoryId, @Param("menuIds") JSONArray menuIds, @Param("tableName") String tableName);

}
